//
//  ActivityInfoTeacherCell.m
//  SDSY
//
//  Created by 蓝布鲁 on 2017/4/5.
//  Copyright (c) 2017 蓝布鲁. All rights reserved.
//

#import "ActivityInfoTeacherCell.h"
#import "ActivityInfoModel.h"

@interface ActivityInfoTeacherCell()

// 视图
@property (nonatomic, retain)UIImageView *teacherImageView;
@property (nonatomic, retain)UILabel *teacherNameLabel;
@property (nonatomic, retain)UILabel *teacherInfoLabel;

@end

@implementation ActivityInfoTeacherCell

- (void)setupView {
    [super setupView];
    // 设置导师头像
    self.teacherImageView = [[UIImageView alloc] init];
    self.teacherImageView.layer.masksToBounds = true;
    self.teacherImageView.layer.cornerRadius = 25;
    [self.contentView addSubview:self.teacherImageView];

    // 设置导师名
    self.teacherNameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.teacherNameLabel];

    // 设置导师详情
    self.teacherInfoLabel = [[UILabel alloc] init];
    self.teacherInfoLabel.font = [UIFont systemFontOfSize:12];
    self.teacherInfoLabel.textColor = UIColor.grayColor;
    [self.contentView addSubview:self.teacherInfoLabel];

    // 设置布局
    self.teacherImageView.sd_layout.leftSpaceToView(self.contentView,10).topSpaceToView(self.contentView,10).widthIs(50).heightIs(50);
    self.teacherNameLabel.sd_layout.leftSpaceToView(self.teacherImageView,10)
            .topEqualToView(self.teacherImageView).rightSpaceToView(self.contentView,10).heightIs(16);
    self.teacherInfoLabel.sd_layout.leftEqualToView(self.teacherNameLabel)
            .topSpaceToView(self.teacherNameLabel,10).rightEqualToView(self.teacherNameLabel).autoHeightRatio(0);
}

- (void)setModel:(ActivityInfoModel *)model {
    // 设置导师头像
    [self.teacherImageView sd_setImageWithURL:[NSURL URLWithString:model.tea_pic] placeholderImage:[UIImage imageNamed:@"avatar_default"]];

    // 设置导师名
    self.teacherNameLabel.text = model.tea_name;

    // 设置导师详情
    self.teacherInfoLabel.text = model.tea_introduce;

    [self setupAutoHeightWithBottomViewsArray:@[self.teacherInfoLabel,self.teacherImageView] bottomMargin:5];
}


@end
